<include file="public@header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:url('student/index')}">学校列表</a></li>
			<li><a href="{:url('student/add')}">添加学生</a></li>
		</ul>
        <form class="well form-inline margin-top-20" method="get" action="{:url('Student/index')}">
			学校名称:
			<div class="form-group">
				<div class="col-md-6 col-sm-10">
					<select name='school_id' class="form-control" id="selectSchool">
						<option value="">请选择学校</option>
						<foreach name="school" item="vo">
							<php>$selectSchool = $vo['id'] == $school_id ? "selected" : ''</php>
							<option value="{$vo.id}" {$selectSchool}>{$vo.school_name}</option>
						</foreach>
					</select>
				</div>
			</div>
			<div class="form-group">
				<div class="col-md-6 col-sm-10">
					<select name='room_id' class="form-control" id="$Room">
						<option value="">请选择班级</option>
						<foreach name="room" item="vo">
							<php>$Room = $vo['id'] == $room_id ? "selected" : ''</php>
							<option value="{$vo.id}" {$Room}>{$vo.room_name}</option>
						</foreach>
					</select>
				</div>
			</div>
            学生姓名:
            <input type="text" class="form-control" name="name" style="width: 120px;" value="{$Request.param.name}" placeholder="请输入学生姓名">
            <input type="submit" class="btn btn-primary" value="搜索" />
            <a class="btn btn-danger" href="{:url('student/index')}">清空</a>
        </form>
		<table class="table table-hover table-bordered">
			<thead>
				<tr>
					<th width="50">ID</th>
					<th>头像</th>
					<th>姓名</th>
					<th>性别</th>
					<th>年龄</th>
					<th>身份证号</th>
					<th>所属班级</th>
					<th>所属学校</th>
					<th>所在省</th>
					<th>所在市</th>
					<th>所在区/县</th>
					<th>详细地址</th>
					<th>创建时间</th>
					<th>修改时间</th>
					<th width="140">{:lang('ACTIONS')}</th>
				</tr>
			</thead>
			<tbody>

				<foreach name="data" item="vo">
				<tr>
					<td>{$key+1}</td>
					<td>
						<if $vo.image !="暂无">
					<img  src="/upload/{$vo.image}" width="50px">
					<else>
						暂无
					</else>
					</if>
					</td>
					<td>{$vo.student_name}</td>
					<td>
						<eq name="$vo.sex" value="1">
							男
							<else/>
							女
						</eq>
					</td>
					<td>{$vo.age}</td>
					<td>{$vo.idcard}</td>
					<td>{$vo.room_name}</td>
					<td>{$vo.school_name}</td>
					<td>{$vo.a}</td>
					<td>{$vo.b}</td>
					<td>{$vo.c}</td>
					<td>{$vo.street}</td>
					<td>{$vo.create_time}</td>
					<td>{$vo.update_time}</td>
					<td>
							<a class="btn btn-xs btn-primary" href='{:url("student/edit",array("id"=>$vo["id"]))}'>{:lang('EDIT')}</a>
							<a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('student/delete',array('id'=>$vo['id']))}">{:lang('DELETE')}</a>

					</td>
				</tr>
				</foreach>
			</tbody>
		</table>
		<div class="pagination">{$page}</div>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
	<script src="__STATIC__/layui/layui.all.js"></script>
	<script>
		$(function () {

			$('#selectSchool').change('click',function () {

				var schoolId=$('#selectSchool').val();

				$.ajax({
					url:"{:url('student/getSchool')}",
					type:"POST",
					data:{school_id:schoolId},
					success:function (res) {
						console.log(res);
						$('#selectRoom').html(res);
					}
				});
			});
		})
	</script>
</body>
</html>